package com.wangsiyu.zookeeper.rmi.server;
import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;
public class RmiServer {
    public static void main(String[] args) throws Exception {
        //定义url地址
        System.out.println("rmi server running......");
        String url = "rmi://localhost:1099/com.wangsiyu.zookeeper.rmi.server.HelloServiceImpl";
        //定义端口
        int port = 1099;
        //注册服务：在JNDI中创建一个注册表
        LocateRegistry.createRegistry(port);
        //绑定服务，将RMI服务的实现类对象与url绑定
        Naming.rebind(url,new HelloServiceImpl());
    }
}
